package com.demo.jfinal.redis.plun;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import com.demo.jfinal.redis.running.ApiOrdersWorker;
import com.jfinal.plugin.IPlugin;

public class RedisOrderQueuePlugin implements IPlugin {

	private static final ExecutorService pool = Executors.newFixedThreadPool(7);

	public boolean start() {
		for (int i = 0; i < 7; i++) {
			pool.submit(new ApiOrdersWorker());
		}
		return true;
	}

	public boolean stop() {
		pool.shutdown();
		return true;
	}

}
